using System.Threading.Tasks;
using InventoryService.Application.Requests;
using MediatR;
using Microsoft.Extensions.DependencyInjection;
using NUnit.Framework;

namespace InventoryService.Test
{
    public class Tests : TestBase
    {
        private IMediator _mediator;

        [SetUp]
        public void Setup()
        {
            _mediator = Provider.GetService<IMediator>();
        }

        [Test]
        public async Task GetByIdTest()
        {
            var request = new GetInventoryRequest("1111");
            var rsp = await _mediator.Send(request);

            Assert.IsNotNull(rsp);
            Assert.AreEqual(rsp.Data.Id, "1111"); 
            Assert.Pass();
        }
        [Test]
        public async Task CreateTest()
        {
            var request = new CreateInventoryRequest
            {
                Description = "xx",
                Location = "222",
                Website = "111"
            };
            var rsp = await _mediator.Send(request);

            Assert.IsNotNull(rsp);
            Assert.Pass();
        }
    }
}